

<!DOCTYPE html>
<html lang="en" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/avatar.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Hughie">
  <meta name="keywords" content="">
  
    <meta name="description" content="总体解决方案Node.js+Git+Hexo+Gitee+PicGo+阿里云OSS Hexo解决博客页面展现以及美化的问题 Gitee解决博客部署问题 PicGo+阿里云OSS解决博客插入图片的存储访问的问题 一、安装Node.js&#x2F;Git、下载Hexo以及主题主题下载        https:&#x2F;&#x2F;hexo.io&#x2F;themes&#x2F;（本博客主题为Fluid） 1. 安装Node.jsNod">
<meta property="og:type" content="article">
<meta property="og:title" content="我的博客搭建解决方案">
<meta property="og:url" content="https://hughie-hy.gitee.io/2022/02/25/%E6%88%91%E7%9A%84%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/index.html">
<meta property="og:site_name" content="Hughie&#39;s blog">
<meta property="og:description" content="总体解决方案Node.js+Git+Hexo+Gitee+PicGo+阿里云OSS Hexo解决博客页面展现以及美化的问题 Gitee解决博客部署问题 PicGo+阿里云OSS解决博客插入图片的存储访问的问题 一、安装Node.js&#x2F;Git、下载Hexo以及主题主题下载        https:&#x2F;&#x2F;hexo.io&#x2F;themes&#x2F;（本博客主题为Fluid） 1. 安装Node.jsNod">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://hughie-hy.gitee.io/img/hexo.png">
<meta property="article:published_time" content="2022-02-25T15:03:33.000Z">
<meta property="article:modified_time" content="2022-03-04T06:18:50.681Z">
<meta property="article:author" content="Hughie">
<meta property="article:tag" content="博客搭建">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://hughie-hy.gitee.io/img/hexo.png">
  
  
  <title>我的博客搭建解决方案 - Hughie&#39;s blog</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"hughie-hy.gitee.io","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":120,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.4.1"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Hughie</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                Home
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                Archives
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                Categories
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                Tags
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                About
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="我的博客搭建解决方案">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2022-02-25 23:03" pubdate>
        February 25, 2022 pm
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      1.3k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      12 分钟
    </span>
  

  
  
    
      <!-- 不蒜子统计文章PV -->
      <span id="busuanzi_container_page_pv" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="busuanzi_value_page_pv"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">我的博客搭建解决方案</h1>
            
            <div class="markdown-body">
              <p><strong>总体解决方案Node.js+Git+Hexo+Gitee+PicGo+阿里云OSS</strong></p>
<p>Hexo解决博客页面展现以及美化的问题</p>
<p>Gitee解决博客部署问题</p>
<p>PicGo+阿里云OSS解决博客插入图片的存储访问的问题</p>
<h2 id="一、安装Node-js-x2F-Git、下载Hexo以及主题"><a href="#一、安装Node-js-x2F-Git、下载Hexo以及主题" class="headerlink" title="一、安装Node.js&#x2F;Git、下载Hexo以及主题"></a>一、安装Node.js&#x2F;Git、下载Hexo以及主题</h2><p>主题下载        <a target="_blank" rel="noopener" href="https://hexo.io/themes/%EF%BC%88%E6%9C%AC%E5%8D%9A%E5%AE%A2%E4%B8%BB%E9%A2%98%E4%B8%BAFluid%EF%BC%89">https://hexo.io/themes/（本博客主题为Fluid）</a></p>
<h3 id="1-安装Node-js"><a href="#1-安装Node-js" class="headerlink" title="1. 安装Node.js"></a>1. 安装Node.js</h3><p>Node.js官网  <a target="_blank" rel="noopener" href="https://nodejs.org/zh-cn/download/">https://nodejs.org/zh-cn/download/</a></p>
<p>请查看相关教程</p>
<h3 id="2-安装Git"><a href="#2-安装Git" class="headerlink" title="2. 安装Git"></a>2. 安装Git</h3><p>Git官网          <a target="_blank" rel="noopener" href="https://git-scm.com/">https://git-scm.com/</a></p>
<p>请查看相关教程</p>
<h3 id="3-安装Hexo"><a href="#3-安装Hexo" class="headerlink" title="3. 安装Hexo"></a>3. 安装Hexo</h3><p>Hexo 官网     <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/">https://hexo.io/zh-cn/</a></p>
<p>按照Hexo官方文档安装Hexo</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225234434626.png" srcset="/img/loading.gif" lazyload></p>
<p>其中的hexo init blog命令会在当前cmd目录下创建blog文件夹（可以改成任何想要的名字）存放博客相关的文件，执行完<code>hexo server</code>命令后可以访问cmd命令行中的地址，如图所示则基本搭建完成</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225235346318.png" srcset="/img/loading.gif" lazyload></p>
<h3 id="4-下载主题"><a href="#4-下载主题" class="headerlink" title="4. 下载主题"></a>4. 下载主题</h3><p>在Hexo官网提供的链接下载想要的主题，解压并放入创建好的博客文件夹下的themes文件夹中</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225235734861.png" srcset="/img/loading.gif" lazyload></p>
<p>在_config.yml文件中修改对应的主题名</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220227131242032.png" srcset="/img/loading.gif" lazyload></p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225235934912.png" srcset="/img/loading.gif" lazyload></p>
<p><code>ctrl+c</code>停止命令行的程序，<code>hexo s</code>再次启动即可完成主题的设置，更多主题的详细设置参考对应主题提供的文档。</p>
<h2 id="二、Gitee部署"><a href="#二、Gitee部署" class="headerlink" title="二、Gitee部署"></a>二、Gitee部署</h2><h3 id="1-创建仓库"><a href="#1-创建仓库" class="headerlink" title="1. 创建仓库"></a>1. 创建仓库</h3><p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225232359252.png" srcset="/img/loading.gif" lazyload></p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220225232500000.png" srcset="/img/loading.gif" lazyload></p>
<p>目的是在后面使用Gitee Pages服务部署后可以直接用<a href="https://hughie-hy.gitee.io/">https://hughie-hy.gitee.io</a>进行访问博客    </p>
<p>初始化一个Readme文件</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220227132239745.png" srcset="/img/loading.gif" lazyload></p>
<h3 id="2-申请Gitee-Pages服务"><a href="#2-申请Gitee-Pages服务" class="headerlink" title="2. 申请Gitee Pages服务"></a>2. 申请Gitee Pages服务</h3><p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220227132505105.png" srcset="/img/loading.gif" lazyload> </p>
<h3 id="3-修改配置文件"><a href="#3-修改配置文件" class="headerlink" title="3. 修改配置文件"></a>3. 修改配置文件</h3><p>打开_config.yml，配置部署仓库地址</p>
<figure class="highlight yaml"><table><tr><td class="gutter hljs"><div class="hljs code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></div></td><td class="code"><div class="hljs code-wrapper"><pre><code class="hljs yaml"><span class="hljs-comment"># URL</span><br><span class="hljs-comment">## Set your site url here. For example, if you use GitHub Page, set url as &#x27;https://username.github.io/project&#x27;</span><br><span class="hljs-attr">url:</span> <span class="hljs-string">https://hughie-hy.gitee.io</span><br><span class="hljs-string">···</span><br><span class="hljs-string">...</span><br><span class="hljs-attr">deploy:</span><br>  <span class="hljs-attr">type:</span> <span class="hljs-string">git</span><br>  <span class="hljs-attr">repo:</span> <span class="hljs-string">https://gitee.com/hughie-hy/hughie-hy.git</span><br>  <span class="hljs-attr">brandch:</span> <span class="hljs-string">master</span><br></code></pre></div></td></tr></table></figure>
<p>配置本地git</p>
<figure class="highlight bash"><table><tr><td class="gutter hljs"><div class="hljs code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></div></td><td class="code"><div class="hljs code-wrapper"><pre><code class="hljs bash">npm install hexo-deployer-git --save	        <span class="hljs-comment"># 安装git插件</span><br>git config --global user.email <span class="hljs-string">&#x27;任意email地址&#x27;</span>	 <span class="hljs-comment"># 设置gitee邮箱（gitee的注册邮箱）</span><br>git config --global user.name <span class="hljs-string">&#x27;hughie-hy&#x27;</span>	    <span class="hljs-comment"># 设置用户名（git的注册昵称）</span><br>hexo deploy	                                    <span class="hljs-comment"># 上传到gitee</span><br></code></pre></div></td></tr></table></figure>

<p>完成<code>hexo deploy</code>之后则上传完成，相应文件已经上传到了你的Gitee仓库中。</p>
<p>点击更新（每次上传完成都要点击更新最终才能完成部署）</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/staticimage-20220227135928415.png" srcset="/img/loading.gif" lazyload></p>
<h2 id="三、配置图床"><a href="#三、配置图床" class="headerlink" title="三、配置图床"></a>三、配置图床</h2><p>阿里云OSS+PicGo，目的是简化markdown文件中的图片管理</p>
<h3 id="1-在阿里云配置OSS"><a href="#1-在阿里云配置OSS" class="headerlink" title="1. 在阿里云配置OSS"></a>1. 在阿里云配置OSS</h3><p>创建Bucket容器</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227143106785.png" srcset="/img/loading.gif" lazyload></p>
<p>简单配置</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227143210314.png" srcset="/img/loading.gif" lazyload></p>
<p>授权处理</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227144532296.png" srcset="/img/loading.gif" lazyload></p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227144616683.png" srcset="/img/loading.gif" lazyload></p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227145145150.png" srcset="/img/loading.gif" lazyload></p>
<p>添加对应权限</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227145222675.png" srcset="/img/loading.gif" lazyload></p>
<h3 id="2-PicGo配置"><a href="#2-PicGo配置" class="headerlink" title="2. PicGo配置"></a>2. PicGo配置</h3><p>创建AccessKey获取KeyId和KeySecret</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227145247747.png" srcset="/img/loading.gif" lazyload></p>
<p>获得KeyId和KeySecret后在PicGo中进行配置</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227144342346.png" srcset="/img/loading.gif" lazyload></p>
<p>Typore配置</p>
<p><img src="https://blog-chy.oss-cn-shenzhen.aliyuncs.com/static/image-20220227145332402.png" srcset="/img/loading.gif" lazyload></p>
<p>至此搭建流程全部完成</p>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">博客搭建</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/02/26/JVM%E7%AC%94%E8%AE%B0/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">JVM</span>
                        <span class="visible-mobile">Previous</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                  </article>
                </div>
              
            </div>

            
              <!-- Comments -->
              <article class="comments" id="comments" lazyload>
                
                  
                
                

              </article>
            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;TOC</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">Search</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">keyword</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  
  <div class="statistics">
    
    

    
      
        <!-- 不蒜子统计PV -->
        <span id="busuanzi_container_site_pv" style="display: none">
            总访问量 
            <span id="busuanzi_value_site_pv"></span>
             次
          </span>
      
      
        <!-- 不蒜子统计UV -->
        <span id="busuanzi_container_site_uv" style="display: none">
            总访客数 
            <span id="busuanzi_value_site_uv"></span>
             人
          </span>
      
    
  </div>


  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>




  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
